#ifndef __CONDITION_H__
#define __CONDITION_H__

template <typename DataType>
struct Condition
{
    virtual
    ~Condition()
    {
    }

    virtual bool
    operator()(DataType) const=0;

};

template <typename DataType>
struct IsGtThan : public Condition<DataType>
{
    IsGtThan(DataType);

    virtual bool
    operator()(DataType) const;

private:
    DataType constraint_m;
};

template <typename DataType>
struct IsLsThan : public Condition<DataType>
{
    IsLsThan(DataType);

    virtual bool
    operator()(DataType) const;

private:
    DataType constraint_m;
};

template <typename DataType>
struct IsNotGtThan : public Condition<DataType>
{
    IsNotGtThan(DataType);

    virtual bool
    operator()(DataType) const;

private:
    IsGtThan<DataType> constraint_m;
};

template <typename DataType>
struct IsNotLsThan : public Condition<DataType>
{
    IsNotLsThan(DataType);

    virtual bool
    operator()(DataType) const;

private:
    IsLsThan<DataType> constraint_m;
};

template <typename DataType>
IsGtThan<DataType>::IsGtThan(DataType constraint) :
    constraint_m(constraint)
{
}

template <typename DataType> bool
IsGtThan<DataType>::operator()(DataType input) const
{
    return input>constraint_m;
}

template <typename DataType>
IsLsThan<DataType>::IsLsThan(DataType constraint) :
    constraint_m(constraint)
{
}

template <typename DataType> bool
IsLsThan<DataType>::operator()(DataType input) const
{
    return input<constraint_m;
}

template <typename DataType>
IsNotGtThan<DataType>::IsNotGtThan(DataType constraint) :
    constraint_m(constraint)
{
}

template <typename DataType> bool
IsNotGtThan<DataType>::operator()(DataType input) const
{
    return !constraint_m(input);
}

template <typename DataType>
IsNotLsThan<DataType>::IsNotLsThan(DataType constraint) :
    constraint_m(constraint)
{
}

template <typename DataType> bool
IsNotLsThan<DataType>::operator()(DataType input) const
{
    return !constraint_m(input);
}


#endif

